<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<ui:composition template="/WEB-INF/templates/padrao.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="cabecalho">
		<ui:include src="/WEB-INF/templates/menuBibli.xhtml" />
	</ui:define>


	<ui:define name="titulo">
		<h2 style="text-align: center">Pesquisa/Reserva Periodico</h2>
	</ui:define>


	<ui:define name="conteudo">
		<div class="hero-unit">

			<h:panelGroup
				rendered="#{pesquisaReservaPeriodicosBean.msg.wmsg}">
				<div class="alert alert-block">
					<button type="button" class="close" data-dismiss="alert">x</button>
					<h4>Atenção!</h4>
					#{pesquisaReservaPeriodicosBean.msg.warningMsg}
				</div>
			</h:panelGroup>


			<h:panelGroup
				rendered="#{pesquisaReservaPeriodicosBean.msg.emsg}">
				<div class="alert alert-error">
					<button type="button" class="close" data-dismiss="alert">x</button>
					<h4>Erro!</h4>
					#{pesquisaReservaPeriodicosBean.msg.erroMsg}
				</div>
			</h:panelGroup>



			<h:panelGroup
				rendered="#{pesquisaReservaPeriodicosBean.msg.smsg}">
				<div class="alert alert-success">
					<button type="button" class="close" data-dismiss="alert">x</button>
					<h4>Sucesso!</h4>
					#{pesquisaReservaPeriodicosBean.msg.sucessMsg}
				</div>
			</h:panelGroup>


			<h:form class="form-signin" id="def">

				<fieldset>
					<legend style="color: blue">Pesquisa/Reserva Periodicos</legend>

					<h:panelGrid columns="2">

						<p:outputLabel value="Palavra Chave: " for="pc" />
						<h:inputText id="pc" label="Palavra Chave: "
							value="#{pesquisaReservaPeriodicosBean.palavraChave}"
							required="true" requiredMessage="*A Palavra Chave é obrigatório!">
						</h:inputText>


						<p:outputLabel value="Termo de Pesquisa: " for="tp" />
						<h:selectOneMenu id="tp" label="Termo de Pesquisa: "
							value="#{pesquisaReservaPeriodicosBean.termoPesquisa}"
							required="true"
							requiredMessage="*O Tipo de Usuário é obrigatório!">
							<f:selectItem itemLabel="--Selecione--" itemValue="Selecione" />
							<f:selectItems value="#{termoPesqBean.termoPesqReserva}" />
						</h:selectOneMenu>





					</h:panelGrid>

					<h:commandButton
						action="#{pesquisaReservaPeriodicosBean.pesquisarPeriodicos}"
						value="Pesquisar" class="btn btn-large btn-primary" for="def" />

				</fieldset>

			</h:form>


			<h:dataTable
				styleClass="table table-striped table-bordered table-hover"
				value="#{pesquisaReservaPeriodicosBean.listaPeriodicos}"
				var="periodico"
				rendered="#{not empty pesquisaReservaPeriodicosBean.listaPeriodicos}">
				<h:column>
					<f:facet name="header">
						<h:outputText value="Codigo" />
					</f:facet>
					<h:outputText value="#{periodico.cod_item}" />
				</h:column>


				<h:column>
					<f:facet name="header">
						<h:outputText value="Nome" />
					</f:facet>
					<h:outputText value="#{periodico.nome}" />
				</h:column>


				<h:column>
					<f:facet name="header">
						<h:outputText value="Tema" />
					</f:facet>
					<h:outputText value="#{periodico.tema}" />
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Ano" />
					</f:facet>
					<h:outputText value="#{periodico.ano}" />
				</h:column>

				



				<h:column style="width:4%">
					
						
						<h:form>
				
					<h:commandButton id="des"
							action="#{pesquisaReservaPeriodicosBean.Reservar(periodico)}"
							ajax="false" title="Reservar" value="Reservar">
							
							<f:setPropertyActionListener value="#{periodico}"
								target="#{pesquisaReservaPeriodicosBean.periodico}" for="des" />
						</h:commandButton>

						
					</h:form >
					
											
						
						
					
				</h:column>


			</h:dataTable>


		</div>
	</ui:define>
</ui:composition>